<template>
  <!--    新增      -->
  <m-ctrl-btn
      :disabled="!!selection.length"
      type="success" title="新增数据"
      @click="$emit('open')"
  >
    <fa icon="plus"></fa>
  </m-ctrl-btn>
  <!--    编辑      -->
  <m-ctrl-btn
      :disabled="!selection.length"
      type="warning" title="编辑数据"
      @click="$emit('open')"
  >
    <fa icon="pen"></fa>
  </m-ctrl-btn>
  <!--    删除      -->
  <m-ctrl-btn
      v-if="!selection.length"
      type="danger" title="清空数据"
      @click="$emit('remove')"
  >
    <fa icon="trash"></fa>
  </m-ctrl-btn>
  <m-ctrl-btn
      v-else
      type="danger" title="删除"
      @click="$emit('remove')"
  >
    <fa icon="remove"></fa>
  </m-ctrl-btn>
  <el-divider direction="vertical"></el-divider>
  <m-ctrl-btn
      v-if="!!selection.length"
      type="success" title="复制数据"
      @click="$emit('copy')"
  >
    <fa icon="clone"></fa>
  </m-ctrl-btn>
  <m-ctrl-btn
      v-else
      type="success" title="上传数据" plain
      @click="$emit('upload')"
  >
    <fa icon="upload"></fa>
  </m-ctrl-btn>
  <m-ctrl-btn
      v-if="!selection.length"
      type="primary" title="下载数据" plain
      @click="$emit('download')"
  >
    <fa icon="download"></fa>
  </m-ctrl-btn>
  <m-ctrl-btn
      v-else
      type="primary" title="粘贴数据" plain
      @click="$emit('download')"
  >
    <fa icon="paste"></fa>
  </m-ctrl-btn>
</template>

<script setup lang="ts">


import MCtrlBtn from "../../common/MCtrlBtn.vue";

defineProps(['selection'])


defineEmits(['remove', 'open', 'copy', 'upload', 'download'])

</script>

<style scoped>

</style>